package com.easygem.front.converter;

import com.easygem.common.model.front.Industry;
import com.easygem.common.vo.front.IndustryVo;
import org.springframework.beans.BeanUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * @author luoxi
 * @version 1.0
 * @className IndustryConverter
 * @Description 行内类型
 * 用于返回给前端的实体转换器
 * @date 2024/12/26 21:43
 */
public class IndustryConverter {
    /**
     * 转vo  ,用于返回给前端的实体
     * @return
     */
    public static IndustryVo converterToIndustryVo(Industry industry){
        IndustryVo industryVo = new IndustryVo();
        BeanUtils.copyProperties(industry,industryVo);
        return industryVo;
    }
    public static List<IndustryVo> converterToIndustryVoList(List<Industry> industries){
        List<IndustryVo> industryVoList = new ArrayList<IndustryVo>();
        for(Industry industry : industries){
            industryVoList.add(converterToIndustryVo(industry));
        };
        return industryVoList;
    }
}
